diff -uNr system-config-printer-1.1.3+git20090218/applet.py system-config-printer-1.1.3+git20090218.patched/applet.py --- system-config-printer-1.1.3+git20090218/applet.py 2009-02-17 16:08:15.000000000 +0100 +++ system-config-printer-1.1.3+git20090218.patched/applet.py 2009-03-04 11:52:11.000000000 +0100 @@ -120,9 +120,16 @@ else: text = _("No driver for this printer.") n = pynotify.Notification (title, text, 'printer') - n.set_urgency (pynotify.URGENCY_CRITICAL) - n.add_action ("setup-printer", _("Search"), - lambda x, y: self.setup_printer (x, y, name, devid)) + if os.environ['gnome-stracciatella']: + n.set_urgency (pynotify.URGENCY_CRITICAL) + n.add_action ("setup-printer", _("Search"), + lambda x, y: + self.setup_printer (x, y, name, devid)) + else: + args = ["--setup-printer", name] + if devid != "": args = args + ["--devid", devid] + self.run_config_tool (args) + else: # name is the name of the queue which hal_lpadmin has set up # automatically. @@ -162,36 +169,56 @@ title = _("Install printer driver") text = _("`%s' requires driver installation: %s.") % (name, pkgs) n = pynotify.Notification (title, text) - n.set_urgency (pynotify.URGENCY_CRITICAL) import installpackage - try: - self.packagekit = installpackage.PackageKit () - n.add_action ("install-driver", _("Install"), - lambda x, y: self.install_driver (x, y, - missing_pkgs)) - except: - pass + if os.environ['gnome-stracciatella']: + try: + self.packagekit = installpackage.PackageKit () + n.add_action ("install-driver", _("Install"), + lambda x, y: + self.install_driver (x, y, + missing_pkgs)) + except: + pass + else: + try: + self.packagekit = installpackage.PackageKit () + self.packagekit.InstallPackageName (0, 0, + missing_pkgs[0]) + except: + pass + elif status == self.STATUS_SUCCESS: text = _("`%s' is ready for printing.") % name n = pynotify.Notification (title, text) - n.set_urgency (pynotify.URGENCY_NORMAL) - n.add_action ("test-page", _("Print test page"), - lambda x, y: self.print_test_page (x, y, name, devid)) - n.add_action ("configure", _("Configure"), - lambda x, y: self.configure (x, y, name)) + if os.environ['gnome-stracciatella']: + n.set_urgency (pynotify.URGENCY_NORMAL) + n.add_action ("test-page", _("Print test page"), + lambda x, y: + self.print_test_page (x, y, name, devid)) + n.add_action ("configure", _("Configure"), + lambda x, y: self.configure (x, y, name)) + else: + self.run_config_tool (["--configure-printer", + name, "--no-focus-on-map"]) else: # Model mismatch devid = "MFG:%s;MDL:%s;DES:%s;CMD:%s;" % \ (mfg, mdl, des, cmd) text = _("`%s' has been added, using the `%s' driver.") % \ (name, driver) n = pynotify.Notification (title, text, 'printer') - n.set_urgency (pynotify.URGENCY_CRITICAL) - n.add_action ("test-page", _("Print test page"), - lambda x, y: self.print_test_page (x, y, name, devid)) - n.add_action ("find-driver", _("Find driver"), - lambda x, y: self.find_driver (x, y, name, devid)) + if os.environ['gnome-stracciatella']: + n.set_urgency (pynotify.URGENCY_CRITICAL) + n.add_action ("test-page", _("Print test page"), + lambda x, y: + self.print_test_page (x, y, name, devid)) + n.add_action ("find-driver", _("Find driver"), + lambda x, y: + self.find_driver (x, y, name, devid)) + n.set_timeout (pynotify.EXPIRES_NEVER) + else: + self.run_config_tool (["--configure-printer", + name, "--no-focus-on-map"]) - n.set_timeout (pynotify.EXPIRES_NEVER) viewer.notify_new_printer (name, n) # Set the icon back how it was. self.timeout_ready () diff -uNr system-config-printer-1.1.3+git20090218/glade/PrintersWindow.glade system-config-printer-1.1.3+git20090218.patched/glade/PrintersWindow.glade --- system-config-printer-1.1.3+git20090218/glade/PrintersWindow.glade 2009-02-17 12:39:05.000000000 +0100 +++ system-config-printer-1.1.3+git20090218.patched/glade/PrintersWindow.glade 2009-03-04 11:37:54.000000000 +0100 @@ -5,7 +5,7 @@ 450 - True + False System-Config-Printer GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE @@ -20,7 +20,6 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST - True False diff -uNr system-config-printer-1.1.3+git20090218/glade.py system-config-printer-1.1.3+git20090218.patched/glade.py --- system-config-printer-1.1.3+git20090218/glade.py 2009-02-17 12:39:05.000000000 +0100 +++ system-config-printer-1.1.3+git20090218.patched/glade.py 2009-03-04 10:58:20.000000000 +0100 @@ -37,4 +37,15 @@ if widget is None: raise ValueError, "Widget '%s' not found" % name setattr(self, name, widget) - xml.signal_autoconnect (self) + + try: + win = widget.get_top_level() + except AttributeError: + win = None + + if win != None: + gtk.Window.set_focus_on_map(widget.get_top_level (), + self.focus_on_map) + widget.show() + + xml.signal_autoconnect(self) diff -uNr system-config-printer-1.1.3+git20090218/system-config-printer.py system-config-printer-1.1.3+git20090218.patched/system-config-printer.py --- system-config-printer-1.1.3+git20090218/system-config-printer.py 2009-02-18 14:15:24.000000000 +0100 +++ system-config-printer-1.1.3+git20090218.patched/system-config-printer.py 2009-03-04 11:03:41.000000000 +0100 @@ -55,6 +55,9 @@ " --print-test-page NAME\n" " Select the named printer on start-up and print a\n" " test page to it.\n\n" + " --no-focus-on-map\n" + " Do not focus the main window, to prevent focus \n" + " stealing\n\n" " --debug Enable debugging output.\n") if len(sys.argv)>1 and sys.argv[1] == '--help': @@ -186,7 +189,8 @@ cups.IPP_PRINTER_STOPPED: _("Stopped") } def __init__(self, setup_printer = None, configure_printer = None, - change_ppd = False, devid = "", print_test_page = False): + change_ppd = False, devid = "", print_test_page = False, + focus_on_map = True): try: self.language = locale.getlocale(locale.LC_MESSAGES) @@ -210,6 +214,7 @@ self.servers = set((self.connect_server,)) self.server_is_publishing = False self.devid = devid + self.focus_on_map = focus_on_map # WIDGETS # ======= @@ -343,6 +348,11 @@ "vboxMarkerLevels", "btnRefreshMarkerLevels"]}) + # Ensure the default PrintersWindow is shown despite + # the --no-focus-on-map option + self.PrintersWindow.set_focus_on_map (self.focus_on_map) + self.PrintersWindow.show() + # Since some dialogs are reused we can't let the delete-event's # default handler destroy them for dialog in [self.PrinterPropertiesDialog, @@ -986,6 +996,7 @@ host = CUPS_server_hostname () self.PrinterPropertiesDialog.set_title (_("Printer Properties - " "'%s' on %s") % (name, host)) + self.PrinterPropertiesDialog.set_focus_on_map (self.focus_on_map) self.PrinterPropertiesDialog.show () def printer_properties_response (self, dialog, response): @@ -1210,6 +1221,7 @@ host = CUPS_server_hostname () self.PrintersWindow.set_title(_("Printer configuration - %s") % host) + self.PrintersWindow.set_focus_on_map (self.focus_on_map) if connected: status_msg = _("Connected to %s") % host @@ -6675,12 +6687,13 @@ def main(setup_printer = None, configure_printer = None, change_ppd = False, - devid = "", print_test_page = False): + devid = "", print_test_page = False, focus_on_map = True): cups.setUser (os.environ.get ("CUPS_USER", cups.getUser())) gtk.gdk.threads_init() mainwindow = GUI(setup_printer, configure_printer, change_ppd, devid, - print_test_page) + print_test_page, focus_on_map) + if gtk.__dict__.has_key("main"): gtk.main() else: @@ -6696,6 +6709,7 @@ 'choose-driver=', 'devid=', 'print-test-page=', + 'no-focus-on-map', 'debug']) except getopt.GetoptError: show_help () @@ -6705,6 +6719,7 @@ configure_printer = None change_ppd = False print_test_page = False + focus_on_map = True devid = "" for opt, optarg in opts: if (opt == "--configure-printer" or @@ -6722,7 +6737,11 @@ elif opt == '--devid': devid = optarg + elif opt == '--no-focus-on-map': + focus_on_map = False + elif opt == '--debug': set_debugging (True) - main(setup_printer, configure_printer, change_ppd, devid, print_test_page) + main(setup_printer, configure_printer, change_ppd, devid, print_test_page, + focus_on_map)