Don't use status icon if notification server supports persistence.
This commit is contained in:
parent
a6502e8f1f
commit
62b52c32a9
316
system-config-printer-statusicon.patch
Normal file
316
system-config-printer-statusicon.patch
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
diff -up system-config-printer-1.2.5/jobviewer.py.statusicon system-config-printer-1.2.5/jobviewer.py
|
||||||
|
--- system-config-printer-1.2.5/jobviewer.py.statusicon 2010-10-13 13:11:15.000000000 +0100
|
||||||
|
+++ system-config-printer-1.2.5/jobviewer.py 2010-11-03 14:08:59.741352866 +0000
|
||||||
|
@@ -277,15 +277,18 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
'time-at-creation'])
|
||||||
|
|
||||||
|
def __init__(self, bus=None, loop=None,
|
||||||
|
- trayicon=False, suppress_icon_hide=False,
|
||||||
|
+ applet=False, suppress_icon_hide=False,
|
||||||
|
my_jobs=True, specific_dests=None, exit_handler=None,
|
||||||
|
parent=None):
|
||||||
|
self.loop = loop
|
||||||
|
- self.trayicon = trayicon
|
||||||
|
+ self.applet = applet
|
||||||
|
self.suppress_icon_hide = suppress_icon_hide
|
||||||
|
self.my_jobs = my_jobs
|
||||||
|
self.specific_dests = specific_dests
|
||||||
|
self.exit_handler = exit_handler
|
||||||
|
+ notify_caps = pynotify.get_server_caps ()
|
||||||
|
+ self.notify_has_actions = "actions" in notify_caps
|
||||||
|
+ self.notify_has_persistence = "persistence" in notify_caps
|
||||||
|
|
||||||
|
self.jobs = {}
|
||||||
|
self.jobiters = {}
|
||||||
|
@@ -403,8 +406,8 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
(False, True, _("Document"), self._set_job_document_text),
|
||||||
|
(False, True, _("Printer"), self._set_job_printer_text),
|
||||||
|
(False, False, _("Size"), self._set_job_size_text)]:
|
||||||
|
- if trayicon and skip:
|
||||||
|
- # Skip the user column for the trayicon.
|
||||||
|
+ if applet and skip:
|
||||||
|
+ # Skip the user column when running as applet.
|
||||||
|
continue
|
||||||
|
|
||||||
|
cell = gtk.CellRendererText()
|
||||||
|
@@ -493,7 +496,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
1.0, 1.0,
|
||||||
|
gtk.gdk.INTERP_BILINEAR,
|
||||||
|
127)
|
||||||
|
- if self.trayicon:
|
||||||
|
+ if self.applet and not self.notify_has_persistence:
|
||||||
|
self.statusicon = gtk.StatusIcon ()
|
||||||
|
pixbuf = load_icon (theme, ICON)
|
||||||
|
self.statusicon.set_from_pixbuf (pixbuf)
|
||||||
|
@@ -514,7 +517,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
host=self.host, port=self.port,
|
||||||
|
encryption=self.encryption)
|
||||||
|
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
self.JobsWindow.show ()
|
||||||
|
|
||||||
|
self.JobsAttributesWindow = gtk.Window()
|
||||||
|
@@ -583,6 +586,9 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
|
||||||
|
# Handle "special" status icon
|
||||||
|
def set_special_statusicon (self, iconname, tooltip=None):
|
||||||
|
+ if self.notify_has_persistence:
|
||||||
|
+ return
|
||||||
|
+
|
||||||
|
self.special_status_icon = True
|
||||||
|
self.statusicon.set_from_icon_name (iconname)
|
||||||
|
self.set_statusicon_visibility ()
|
||||||
|
@@ -590,6 +596,9 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.set_statusicon_tooltip (tooltip=tooltip)
|
||||||
|
|
||||||
|
def unset_special_statusicon (self):
|
||||||
|
+ if self.notify_has_persistence:
|
||||||
|
+ return
|
||||||
|
+
|
||||||
|
self.special_status_icon = False
|
||||||
|
self.statusicon.set_from_pixbuf (self.saved_statusicon_pixbuf)
|
||||||
|
self.set_statusicon_visibility ()
|
||||||
|
@@ -600,7 +609,9 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
notification.set_data ('printer-name', printer)
|
||||||
|
notification.connect ('closed', self.on_new_printer_notification_closed)
|
||||||
|
self.set_statusicon_visibility ()
|
||||||
|
- notification.attach_to_status_icon (self.statusicon)
|
||||||
|
+ if not self.notify_has_persistence:
|
||||||
|
+ notification.attach_to_status_icon (self.statusicon)
|
||||||
|
+
|
||||||
|
try:
|
||||||
|
notification.show ()
|
||||||
|
except gobject.GError:
|
||||||
|
@@ -617,7 +628,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.statusicon.set_from_pixbuf (pb)
|
||||||
|
|
||||||
|
def on_delete_event(self, *args):
|
||||||
|
- if self.trayicon or not self.loop:
|
||||||
|
+ if self.applet or not self.loop:
|
||||||
|
self.JobsWindow.hide ()
|
||||||
|
self.JobsWindow.set_data ('visible', False)
|
||||||
|
if not self.loop:
|
||||||
|
@@ -642,25 +653,31 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
if force_show:
|
||||||
|
visible = False
|
||||||
|
|
||||||
|
- if visible:
|
||||||
|
- w = self.JobsWindow.window
|
||||||
|
- aw = self.JobsAttributesWindow.window
|
||||||
|
- (s, area, o) = self.statusicon.get_geometry ()
|
||||||
|
- w.set_skip_taskbar_hint (True)
|
||||||
|
- if aw != None:
|
||||||
|
- aw.set_skip_taskbar_hint (True)
|
||||||
|
-
|
||||||
|
- w.property_change ("_NET_WM_ICON_GEOMETRY",
|
||||||
|
- "CARDINAL", 32,
|
||||||
|
- gtk.gdk.PROP_MODE_REPLACE,
|
||||||
|
- list (area))
|
||||||
|
- self.JobsWindow.iconify ()
|
||||||
|
+ if self.notify_has_persistence:
|
||||||
|
+ if visible:
|
||||||
|
+ self.JobsWindow.hide ()
|
||||||
|
+ else:
|
||||||
|
+ self.JobsWindow.show ()
|
||||||
|
else:
|
||||||
|
- self.JobsWindow.present ()
|
||||||
|
- self.JobsWindow.window.set_skip_taskbar_hint (False)
|
||||||
|
- aw = self.JobsAttributesWindow.window
|
||||||
|
- if aw != None:
|
||||||
|
- aw.set_skip_taskbar_hint (False)
|
||||||
|
+ if visible:
|
||||||
|
+ w = self.JobsWindow.window
|
||||||
|
+ aw = self.JobsAttributesWindow.window
|
||||||
|
+ (s, area, o) = self.statusicon.get_geometry ()
|
||||||
|
+ w.set_skip_taskbar_hint (True)
|
||||||
|
+ if aw != None:
|
||||||
|
+ aw.set_skip_taskbar_hint (True)
|
||||||
|
+
|
||||||
|
+ w.property_change ("_NET_WM_ICON_GEOMETRY",
|
||||||
|
+ "CARDINAL", 32,
|
||||||
|
+ gtk.gdk.PROP_MODE_REPLACE,
|
||||||
|
+ list (area))
|
||||||
|
+ self.JobsWindow.iconify ()
|
||||||
|
+ else:
|
||||||
|
+ self.JobsWindow.present ()
|
||||||
|
+ self.JobsWindow.window.set_skip_taskbar_hint (False)
|
||||||
|
+ aw = self.JobsAttributesWindow.window
|
||||||
|
+ if aw != None:
|
||||||
|
+ aw.set_skip_taskbar_hint (False)
|
||||||
|
|
||||||
|
self.JobsWindow.set_data ('visible', not visible)
|
||||||
|
|
||||||
|
@@ -857,7 +874,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.treeview.queue_draw ()
|
||||||
|
|
||||||
|
# Check whether authentication is required.
|
||||||
|
- if self.trayicon:
|
||||||
|
+ if self.applet:
|
||||||
|
job_requires_auth = (s == cups.IPP_JOB_HELD and
|
||||||
|
data.get ('job-hold-until', 'none') ==
|
||||||
|
'auth-info-required')
|
||||||
|
@@ -1041,7 +1058,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
dialog.destroy ()
|
||||||
|
|
||||||
|
def set_statusicon_visibility (self):
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.suppress_icon_hide:
|
||||||
|
@@ -1061,6 +1078,9 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
debugprint ("num_jobs: %d" % num_jobs)
|
||||||
|
debugprint ("num_jobs_when_hidden: %d" % self.num_jobs_when_hidden)
|
||||||
|
|
||||||
|
+ if self.notify_has_persistence:
|
||||||
|
+ return
|
||||||
|
+
|
||||||
|
self.statusicon.set_visible (self.special_status_icon or
|
||||||
|
open_notifications > 0 or
|
||||||
|
num_jobs > self.num_jobs_when_hidden)
|
||||||
|
@@ -1495,7 +1515,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
return pixbuf
|
||||||
|
|
||||||
|
def get_icon_pixbuf (self, have_jobs=None):
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
return
|
||||||
|
|
||||||
|
if have_jobs == None:
|
||||||
|
@@ -1519,7 +1539,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
return pixbuf
|
||||||
|
|
||||||
|
def set_statusicon_tooltip (self, tooltip=None):
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
return
|
||||||
|
|
||||||
|
if tooltip == None:
|
||||||
|
@@ -1577,7 +1597,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.statusbar.pop (0)
|
||||||
|
self.statusbar_set = False
|
||||||
|
|
||||||
|
- if self.trayicon:
|
||||||
|
+ if self.applet:
|
||||||
|
pixbuf = self.get_icon_pixbuf (have_jobs=have_jobs)
|
||||||
|
self.set_statusicon_from_pixbuf (pixbuf)
|
||||||
|
self.set_statusicon_visibility ()
|
||||||
|
@@ -1623,13 +1643,15 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
notification = pynotify.Notification (title, text, 'printer')
|
||||||
|
reason.user_notified = True
|
||||||
|
notification.set_urgency (urgency)
|
||||||
|
- if "actions" in pynotify.get_server_caps():
|
||||||
|
+ if self.notify_has_actions:
|
||||||
|
notification.set_timeout (pynotify.EXPIRES_NEVER)
|
||||||
|
notification.connect ('closed',
|
||||||
|
self.on_state_reason_notification_closed)
|
||||||
|
self.state_reason_notifications[reason.get_tuple ()] = notification
|
||||||
|
self.set_statusicon_visibility ()
|
||||||
|
- notification.attach_to_status_icon (self.statusicon)
|
||||||
|
+ if not self.notify_has_persistence:
|
||||||
|
+ notification.attach_to_status_icon (self.statusicon)
|
||||||
|
+
|
||||||
|
try:
|
||||||
|
notification.show ()
|
||||||
|
except gobject.GError:
|
||||||
|
@@ -1685,7 +1707,9 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
notification.set_data ('jobid', jobid)
|
||||||
|
self.completed_job_notifications[jobid] = notification
|
||||||
|
self.set_statusicon_visibility ()
|
||||||
|
- notification.attach_to_status_icon (self.statusicon)
|
||||||
|
+ if not self.notify_has_persistence:
|
||||||
|
+ notification.attach_to_status_icon (self.statusicon)
|
||||||
|
+
|
||||||
|
try:
|
||||||
|
notification.show ()
|
||||||
|
except gobject.GError:
|
||||||
|
@@ -1755,7 +1779,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.active_jobs.remove (jobid)
|
||||||
|
|
||||||
|
self.update_status (have_jobs=True)
|
||||||
|
- if self.trayicon:
|
||||||
|
+ if self.applet:
|
||||||
|
if not self.job_is_active (jobdata):
|
||||||
|
return
|
||||||
|
|
||||||
|
@@ -1792,9 +1816,9 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
jobdata = self.jobs[jobid]
|
||||||
|
|
||||||
|
# If the job has finished, let the user know.
|
||||||
|
- if self.trayicon and (eventname == 'job-completed' or
|
||||||
|
- (eventname == 'job-state-changed' and
|
||||||
|
- event['job-state'] == cups.IPP_JOB_COMPLETED)):
|
||||||
|
+ if self.applet and (eventname == 'job-completed' or
|
||||||
|
+ (eventname == 'job-state-changed' and
|
||||||
|
+ event['job-state'] == cups.IPP_JOB_COMPLETED)):
|
||||||
|
reasons = event['job-state-reasons']
|
||||||
|
if type (reasons) != list:
|
||||||
|
reasons = [reasons]
|
||||||
|
@@ -1809,7 +1833,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.notify_completed_job (jobid)
|
||||||
|
|
||||||
|
# Look out for stopped jobs.
|
||||||
|
- if (self.trayicon and
|
||||||
|
+ if (self.applet and
|
||||||
|
(eventname == 'job-stopped' or
|
||||||
|
(eventname == 'job-state-changed' and
|
||||||
|
event['job-state'] in [cups.IPP_JOB_STOPPED,
|
||||||
|
@@ -1869,7 +1893,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
|
||||||
|
if may_be_problem:
|
||||||
|
debugprint ("Problem detected")
|
||||||
|
- self.toggle_window_display (self.statusicon, force_show=True)
|
||||||
|
+ self.toggle_window_display (None, force_show=True)
|
||||||
|
dialog = gtk.Dialog (_("Print Error"), self.JobsWindow, 0,
|
||||||
|
(_("_Diagnose"), gtk.RESPONSE_NO,
|
||||||
|
gtk.STOCK_OK, gtk.RESPONSE_OK))
|
||||||
|
@@ -1913,9 +1937,9 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
monitor.Watcher.job_removed (self, mon, jobid, eventname, event)
|
||||||
|
|
||||||
|
# If the job has finished, let the user know.
|
||||||
|
- if self.trayicon and (eventname == 'job-completed' or
|
||||||
|
- (eventname == 'job-state-changed' and
|
||||||
|
- event['job-state'] == cups.IPP_JOB_COMPLETED)):
|
||||||
|
+ if self.applet and (eventname == 'job-completed' or
|
||||||
|
+ (eventname == 'job-state-changed' and
|
||||||
|
+ event['job-state'] == cups.IPP_JOB_COMPLETED)):
|
||||||
|
reasons = event['job-state-reasons']
|
||||||
|
debugprint (reasons)
|
||||||
|
if type (reasons) != list:
|
||||||
|
@@ -1960,7 +1984,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.update_status ()
|
||||||
|
self.treeview.queue_draw ()
|
||||||
|
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Find out if the user has jobs queued for that printer.
|
||||||
|
@@ -1993,7 +2017,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
self.update_status ()
|
||||||
|
self.treeview.queue_draw ()
|
||||||
|
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
return
|
||||||
|
|
||||||
|
tuple = reason.get_tuple ()
|
||||||
|
@@ -2014,7 +2038,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
|
||||||
|
def still_connecting (self, mon, reason):
|
||||||
|
monitor.Watcher.still_connecting (self, mon, reason)
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.notify_printer_state_reason (reason)
|
||||||
|
@@ -2022,7 +2046,7 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||||
|
def now_connected (self, mon, printer):
|
||||||
|
monitor.Watcher.now_connected (self, mon, printer)
|
||||||
|
|
||||||
|
- if not self.trayicon:
|
||||||
|
+ if not self.applet:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Find the connecting-to-device state reason.
|
@ -7,7 +7,7 @@
|
|||||||
Summary: A printer administration tool
|
Summary: A printer administration tool
|
||||||
Name: system-config-printer
|
Name: system-config-printer
|
||||||
Version: 1.2.5
|
Version: 1.2.5
|
||||||
Release: 6%{?dist}
|
Release: 7%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://cyberelk.net/tim/software/system-config-printer/
|
URL: http://cyberelk.net/tim/software/system-config-printer/
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -20,6 +20,7 @@ Patch1: system-config-printer-InstallPrinterDrivers-debug.patch
|
|||||||
Patch2: system-config-printer-mfg-mdl.patch
|
Patch2: system-config-printer-mfg-mdl.patch
|
||||||
Patch3: system-config-printer-NPTLpdQueue.patch
|
Patch3: system-config-printer-NPTLpdQueue.patch
|
||||||
Patch4: system-config-printer-uint32.patch
|
Patch4: system-config-printer-uint32.patch
|
||||||
|
Patch5: system-config-printer-statusicon.patch
|
||||||
Patch101: pysmbc-doczip.patch
|
Patch101: pysmbc-doczip.patch
|
||||||
BuildRequires: cups-devel >= 1.2
|
BuildRequires: cups-devel >= 1.2
|
||||||
BuildRequires: python-devel >= 2.4
|
BuildRequires: python-devel >= 2.4
|
||||||
@ -92,6 +93,9 @@ printers.
|
|||||||
# Make sure InstallPrinterDrivers gets correctly typed values (bug #647270).
|
# Make sure InstallPrinterDrivers gets correctly typed values (bug #647270).
|
||||||
%patch4 -p1 -b .uint32
|
%patch4 -p1 -b .uint32
|
||||||
|
|
||||||
|
# Don't use status icon if notification server supports persistence.
|
||||||
|
%patch5 -p1 -b .statusicon
|
||||||
|
|
||||||
pushd pysmbc-%{pysmbc_version}
|
pushd pysmbc-%{pysmbc_version}
|
||||||
%patch101 -p1 -b .doczip
|
%patch101 -p1 -b .doczip
|
||||||
popd
|
popd
|
||||||
@ -215,6 +219,9 @@ rm -rf %buildroot
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Nov 3 2010 Tim Waugh <twaugh@redhat.com> - 1.2.5-7
|
||||||
|
- Don't use status icon if notification server supports persistence.
|
||||||
|
|
||||||
* Fri Oct 29 2010 Tim Waugh <twaugh@redhat.com> - 1.2.5-6
|
* Fri Oct 29 2010 Tim Waugh <twaugh@redhat.com> - 1.2.5-6
|
||||||
- Make sure InstallPrinterDrivers gets correctly typed values (bug #647270).
|
- Make sure InstallPrinterDrivers gets correctly typed values (bug #647270).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user