rpms/system-config-printer/devel system-config-printer-git-1.1.x.patch, NONE, 1.1 system-config-printer.spec, 1.243, 1.244

Tim Waugh twaugh at fedoraproject.org
Thu Feb 5 13:07:33 UTC 2009


Author: twaugh

Update of /cvs/pkgs/rpms/system-config-printer/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31750

Modified Files:
	system-config-printer.spec 
Added Files:
	system-config-printer-git-1.1.x.patch 
Log Message:
* Thu Feb  5 2009 Tim Waugh <twaugh at redhat.com> 1.1.3-2
- Added in cups-pk-helper support from upstream.


system-config-printer-git-1.1.x.patch:

--- NEW FILE system-config-printer-git-1.1.x.patch ---
diff -up system-config-printer-1.1.3/authconn.py.git-1.1.x system-config-printer-1.1.3/authconn.py
--- system-config-printer-1.1.3/authconn.py.git-1.1.x	2009-02-02 17:49:39.000000000 +0000
+++ system-config-printer-1.1.3/authconn.py	2009-02-05 10:52:40.000000000 +0000
@@ -19,8 +19,10 @@
 
 import threading
 import cups
+import cupspk
 import gobject
 import gtk
+from errordialogs import *
 from debug import *
 
 _ = lambda x: x
@@ -151,17 +153,29 @@ class Connection:
 
     def _connect (self):
         cups.setUser (self._use_user)
-        self._connection = cups.Connection (host=self._server,
+
+        self._use_pk = self._server[0] == '/' or self._server == 'localhost'
+        if self._use_pk:
+            create_object = cupspk.Connection
+        else:
+            create_object = cups.Connection
+
+        self._connection = create_object (host=self._server,
                                             port=self._port,
                                             encryption=self._encryption)
+
+        if self._use_pk:
+            self._connection.set_parent(self._parent)
+
         self._user = self._use_user
         debugprint ("Connected as user %s" % self._user)
-        methodtype = type (self._connection.getPrinters)
+        methodtype_lambda = type (self._connection.getPrinters)
+        methodtype_real = type (self._connection.addPrinter)
         for fname in dir (self._connection):
             if fname[0] == '_':
                 continue
             fn = getattr (self._connection, fname)
-            if type (fn) != methodtype:
+            if not type (fn) in [methodtype_lambda, methodtype_real]:
                 continue
             setattr (self, fname, self._make_binding (fname, fn))
 
@@ -190,6 +204,11 @@ class Connection:
                         raise cups.IPPError (cups.IPP_NOT_AUTHORIZED, '')
                 break
             except cups.IPPError, (e, m):
+                if self._use_pk and m == 'pkcancel':
+                    title = 'Unauthorized request (%s)' % fname
+                    text = 'You are not authorized for the requested action'
+                    show_info_dialog (title, text, None)
+                    raise cups.IPPError (0, _("Operation canceled"))
                 if not self._cancel and (e == cups.IPP_NOT_AUTHORIZED or
                                          e == cups.IPP_FORBIDDEN):
                     self._failed (e == cups.IPP_FORBIDDEN)
diff -U0 system-config-printer-1.1.3/ChangeLog.git-1.1.x system-config-printer-1.1.3/ChangeLog
--- system-config-printer-1.1.3/ChangeLog.git-1.1.x	2009-02-02 17:49:39.000000000 +0000
+++ system-config-printer-1.1.3/ChangeLog	2009-02-05 10:52:40.000000000 +0000
@@ -0,0 +1,13 @@
+2009-02-04  Tim Waugh  <twaugh at redhat.com>
+
+	* jobviewer.py (JobViewer.set_statusicon_visibility): Fixed typo.
+	(JobViewer.job_added): Only add this job to the active set if it
+	is active; otherwise, remove it from the set if it is there.
+	(JobViewer.job_event): If the emptiness of the active set has
+	changed, update the status icon (trac #140).
+
+2009-02-04  Tim Waugh  <twaugh at redhat.com>
+
+	* jobviewer.py (JobViewer.set_statusicon_visibility): Don't
+	display status icon for completed jobs (trac #140).
+
diff -up /dev/null system-config-printer-1.1.3/cupspk.py
--- /dev/null	2009-02-05 08:56:23.492001950 +0000
+++ system-config-printer-1.1.3/cupspk.py	2009-02-05 10:52:40.000000000 +0000
@@ -0,0 +1,732 @@
+# vim: set ts=4 sw=4 et: coding=UTF-8
+#
+# Copyright (C) 2008 Novell, Inc.
+# Copyright (C) 2009 Red Hat, Inc.
+# Copyright (C) 2009 Tim Waugh <twaugh at redhat.com>
+#
+# Authors: Vincent Untz
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# check FIXME/TODO here
+# check FIXME/TODO in cups-pk-helper
+# define fine-grained policy (more than one level of permission)
+# add missing methods
+
+import os
+import sys
+
+import tempfile
+
+import cups
+import dbus
+import gtk
+
+from dbus.mainloop.glib import DBusGMainLoop
+DBusGMainLoop(set_as_default=True)
+
+PK_AUTH_NAME  = 'org.freedesktop.PolicyKit.AuthenticationAgent'
+PK_AUTH_PATH  = '/'
+PK_AUTH_IFACE = 'org.freedesktop.PolicyKit.AuthenticationAgent'
+
+CUPS_PK_NAME  = 'org.opensuse.CupsPkHelper.Mechanism'
+CUPS_PK_PATH  = '/'
+CUPS_PK_IFACE = 'org.opensuse.CupsPkHelper.Mechanism'
+
+CUPS_PK_NEED_AUTH = 'org.opensuse.CupsPkHelper.Mechanism.NotPrivileged'
+
+
+pk_auth_ret = False
+pk_auth_error = None
+pk_auth_running = False
+pk_auth_done = False
+
+def _pk_auth_reply_handler(ret):
+    global pk_auth_ret
+    global pk_auth_done
+
+    pk_auth_ret = ret
+    pk_auth_done = True
+
+def _pk_auth_error_handler(e):
+    global pk_auth_error
+    global pk_auth_done
+
+    pk_auth_error = str(e)
+    pk_auth_done = True
+
+
+# we can't subclass cups.Connection, even when adding
+# Py_TPFLAGS_BASETYPE to cupsconnection.c
+# So we'll hack this...
+class Connection:
+    def __init__(self, host, port, encryption):
+        self._parent = None
+
+        try:
+            self._session_bus = dbus.SessionBus()
+            self._system_bus = dbus.SystemBus()
+        except dbus.exceptions.DBusException:
+            # One or other bus not running.
+            self._session_bus = self._system_bus = None
+
+        self._connection = cups.Connection(host=host,
+                                           port=port,
+                                           encryption=encryption)
+
+        self._hack_subclass()
+
+
+    def _hack_subclass(self):
+        # here's how to subclass without really subclassing. Just provide
+        # the same methods
+        methodtype = type(self._connection.getPrinters)
+        for fname in dir(self._connection):
+            if fname[0] == '_':
+                continue
+            fn = getattr(self._connection, fname)
+            if type(fn) != methodtype:
+                continue
+            if not hasattr(self, fname):
+                setattr(self, fname, fn.__call__)
+
+
+    def set_parent(self, parent):
+        self._parent = parent
+
+
+    def _get_cups_pk(self):
+        try:
+            object = self._system_bus.get_object(CUPS_PK_NAME, CUPS_PK_PATH)
+            return dbus.Interface(object, CUPS_PK_IFACE)
+        except dbus.exceptions.DBusException:
+            # Failed to get object or interface.
+            return None
+        except AttributeError:
+            # No system D-Bus
[...3975 lines suppressed...]
 
 #: ../troubleshoot/ChooseNetworkPrinter.py:75
 #: ../troubleshoot/ChoosePrinter.py:64 ../troubleshoot/DeviceListed.py:70
-#, fuzzy
 msgid "Not listed"
-msgstr "접속되지 않음"
+msgstr "목록에 없음 "
 
 #: ../troubleshoot/ChoosePrinter.py:30
-#, fuzzy
 msgid "Choose Printer"
-msgstr "프린터 복사"
+msgstr "프린터 선택 "
 
 #: ../troubleshoot/ChoosePrinter.py:31
 msgid ""
@@ -2822,9 +2796,8 @@ msgid ""
 msgstr ""
 
 #: ../troubleshoot/DeviceListed.py:30
-#, fuzzy
 msgid "Choose Device"
-msgstr "URI 장치 변경"
+msgstr "장치 선택 "
 
 #: ../troubleshoot/DeviceListed.py:31
 msgid ""
@@ -2834,7 +2807,7 @@ msgstr ""
 
 #: ../troubleshoot/ErrorLogCheckpoint.py:31
 msgid "Debugging"
-msgstr ""
+msgstr "디버깅 "
 
 #: ../troubleshoot/ErrorLogCheckpoint.py:32
 msgid ""
@@ -2864,7 +2837,7 @@ msgstr ""
 
 #: ../troubleshoot/Locale.py:29
 msgid "Incorrect Page Size"
-msgstr ""
+msgstr "잘못된 페이지 크기 "
 
 #: ../troubleshoot/Locale.py:30
 msgid ""
@@ -2873,29 +2846,24 @@ msgid ""
 msgstr ""
 
 #: ../troubleshoot/Locale.py:43
-#, fuzzy
 msgid "Print job page size:"
-msgstr "테스트 페이지 인쇄"
+msgstr "인쇄 작업 페이지 크기: "
 
 #: ../troubleshoot/Locale.py:48
-#, fuzzy
 msgid "Printer page size:"
-msgstr "프린터 관련사항: "
+msgstr "프린터 페이지 크기: "
 
 #: ../troubleshoot/LocalOrRemote.py:26
-#, fuzzy
 msgid "Printer Location"
-msgstr "프린터 옵션"
+msgstr "프린터 위치 "
 
 #: ../troubleshoot/LocalOrRemote.py:27
-#, fuzzy
 msgid "Is the printer connected to this computer or available on the network?"
-msgstr "프린터가 병렬 포트에 연결되어 있습니다."
+msgstr "프린터가 컴퓨터에 연결되어 있습니까 아니면 네트워크에서 사용 가능합니까? "
 
 #: ../troubleshoot/LocalOrRemote.py:29
-#, fuzzy
 msgid "Locally connected printer"
-msgstr "정말로 프린터 %s(을)를 삭제하시겠습니까?"
+msgstr "로컬로 연결된 프린터 "
 
 #: ../troubleshoot/NetworkCUPSPrinterShared.py:28
 msgid "Queue Not Shared"
@@ -2906,18 +2874,17 @@ msgid "The CUPS printer on the server is
 msgstr ""
 
 #: ../troubleshoot/PrinterStateReasons.py:29
-#, fuzzy
 msgid "Status Messages"
-msgstr "메세지"
+msgstr "상태 메세지"
 
 #: ../troubleshoot/PrinterStateReasons.py:30
 msgid "There are status messages associated with this queue."
 msgstr ""
 
 #: ../troubleshoot/PrinterStateReasons.py:58
-#, fuzzy, python-format
+#, python-format
 msgid "The printer's state message is: `%s'."
-msgstr "프린터 관련사항: "
+msgstr "프린터 상태 메세지: `%s'."
 
 #: ../troubleshoot/PrinterStateReasons.py:83
 msgid "Errors are listed below:"
@@ -2928,9 +2895,8 @@ msgid "Warnings are listed below:"
 msgstr ""
 
 #: ../troubleshoot/PrintTestPage.py:62
-#, fuzzy
 msgid "Test Page"
-msgstr "테스트 페이지 인쇄"
+msgstr "테스트 페이지 "
 
 #: ../troubleshoot/PrintTestPage.py:63
 msgid ""
@@ -2943,9 +2909,8 @@ msgid "Cancel All Jobs"
 msgstr ""
 
 #: ../troubleshoot/PrintTestPage.py:81
-#, fuzzy
 msgid "Test"
-msgstr "다시 설정"
+msgstr "테스트 "
 
 #: ../troubleshoot/PrintTestPage.py:111
 msgid "Did the marked print jobs print correctly?"
@@ -3009,9 +2974,8 @@ msgid ""
 msgstr ""
 
 #: ../troubleshoot/RemoteAddress.py:26
-#, fuzzy
 msgid "Remote Address"
-msgstr "원격 프린터"
+msgstr "원격 주소 "
 
 #: ../troubleshoot/RemoteAddress.py:27
 msgid ""
@@ -3020,9 +2984,8 @@ msgid ""
 msgstr ""
 
 #: ../troubleshoot/RemoteAddress.py:35
-#, fuzzy
 msgid "Server name:"
-msgstr "사용자 이름:"
+msgstr "서버 이름:"
 
 #: ../troubleshoot/RemoteAddress.py:42
 msgid "Server IP address:"
@@ -3044,9 +3007,8 @@ msgid "Check Server Firewall"
 msgstr ""
 
 #: ../troubleshoot/ServerFirewalled.py:27
-#, fuzzy
 msgid "It is not possible to connect to the server."
-msgstr "CUPS 서버로 연결하는 도중 오류가 발생했습니다."
+msgstr "서버로 연결할 수 없습니다. "
 
 #: ../troubleshoot/ServerFirewalled.py:42
 #, python-format
@@ -3092,9 +3054,8 @@ msgid "Missing printer driver"
 msgstr "프린터 드라이버가 없음"
 
 #: ../applet.py:140
-#, fuzzy
 msgid "Install printer driver"
-msgstr "드라이버 설치"
+msgstr "프린터 드라이버 설치 "
 
 #: ../applet.py:141
 #, python-format
@@ -3107,9 +3068,8 @@ msgid "`%s' is ready for printing."
 msgstr "`%s'이(가) 인쇄할 준비가 되어 있습니다."
 
 #: ../applet.py:156 ../applet.py:167
-#, fuzzy
 msgid "Print test page"
-msgstr "테스트 페이지 인쇄"
+msgstr "테스트 페이지 인쇄 "
 
 #: ../applet.py:158
 msgid "Configure"
@@ -3144,8 +3104,3 @@ msgstr "인쇄 작업 관리"
 msgid "Select default printer"
 msgstr "기본 프린터 선택"
 
-#~ msgid "Show _printer status"
-#~ msgstr "프린터 상태 보기(_P)"
-
-#~ msgid "Printer status"
-#~ msgstr "프린터 상태"
diff -up system-config-printer-1.1.3/system-config-printer.py.git-1.1.x system-config-printer-1.1.3/system-config-printer.py
--- system-config-printer-1.1.3/system-config-printer.py.git-1.1.x	2009-02-03 12:30:29.000000000 +0000
+++ system-config-printer-1.1.3/system-config-printer.py	2009-02-05 10:52:40.000000000 +0000
@@ -2003,7 +2003,7 @@ class GUI(GtkGUI, monitor.Watcher):
         self.cups._end_operation ()
         self.changed = set() # of options
 
-        if not self.__dict__.has_key ("server_settings"):
+        if not self.cups._use_pk and not self.__dict__.has_key ("server_settings"):
             # We can authenticate with the server correctly at this point,
             # but we have never fetched the server settings to see whether
             # the server is publishing shared printers.  Fetch the settings


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/devel/system-config-printer.spec,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -r1.243 -r1.244
--- system-config-printer.spec	3 Feb 2009 12:54:27 -0000	1.243
+++ system-config-printer.spec	5 Feb 2009 13:07:03 -0000	1.244
@@ -7,13 +7,14 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 1.1.3
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+
 URL: http://cyberelk.net/tim/software/system-config-printer/
 Group: System Environment/Base
 Source0: http://cyberelk.net/tim/data/system-config-printer/1.1/system-config-printer-%{version}.tar.bz2
 Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2
 Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
+Patch1: system-config-printer-git-1.1.x.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -62,6 +63,7 @@
 
 %prep
 %setup -q -a 1 -a 2
+%patch1 -p1 -b .git-1.1.x
 
 %build
 %configure
@@ -162,6 +164,9 @@
 exit 0
 
 %changelog
+* Thu Feb  5 2009 Tim Waugh <twaugh at redhat.com> 1.1.3-2
+- Added in cups-pk-helper support from upstream.
+
 * Tue Feb  3 2009 Tim Waugh <twaugh at redhat.com> 1.1.3-1
 - Requires python-sexy.
 - 1.1.3.




More information about the fedora-extras-commits mailing list