diff --git a/system-config-printer.py b/system-config-printer.py index a4efecb..3ae63f0 100755 --- a/system-config-printer.py +++ b/system-config-printer.py @@ -46,7 +46,8 @@ def show_help(): print ("\nThis is system-config-printer, " \ "a CUPS server configuration program.\n\n" "Options:\n\n" - " --debug Enable debugging output.\n") + " --debug Enable debugging output.\n" + " --embedded Enable to start in Embedded mode.\n " ) if len(sys.argv)>1 and sys.argv[1] == '--help': show_help () @@ -98,6 +99,9 @@ pkgdata = config.pkgdatadir iconpath = os.path.join (pkgdata, 'icons/') sys.path.append (pkgdata) +PlugWindow = None +PlugWindowId = None + def CUPS_server_hostname (): host = cups.getServer () if host[0] == '/': @@ -202,7 +206,17 @@ class GUI(GtkGUI): domain=config.PACKAGE) - + if PlugWindowId: + self.PrintersWindow.hide() + # the "vbox4" widget + vbox = self.PrintersWindow.get_children()[0] + PlugWindow = gtk.Plug(PlugWindowId) + gtk.Container.remove(self.PrintersWindow, vbox) + PlugWindow.add(vbox) + self.PrintersWindow.set_transient_for(PlugWindow) + PlugWindow.show_all() + self.PrintersWindow = PlugWindow + # Since some dialogs are reused we can't let the delete-event's # default handler destroy them self.ConnectingDialog.connect ("delete-event", @@ -2141,7 +2155,8 @@ if __name__ == "__main__": import getopt try: opts, args = getopt.gnu_getopt (sys.argv[1:], '', - ['debug']) + ['embedded=', + 'debug']) except getopt.GetoptError: show_help () sys.exit (1) @@ -2150,5 +2165,7 @@ if __name__ == "__main__": if opt == '--debug': set_debugging (True) cupshelpers.ppds.set_debugprint_fn (debugprint) + if opt == "--embedded": + PlugWindowId = long(optarg) main()