tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / preferences / printers / Globals.cpp
blobebc14ddc971f7afe79863062fd24ef19b4608aa6
1 /*
2 * Copyright 2001-2010, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Michael Pfeiffer
7 */
10 #include "Globals.h"
12 #include <stdio.h>
14 #include <Roster.h>
16 #include "pr_server.h"
19 BString
20 ActivePrinterName()
22 BMessenger msgr;
23 if (GetPrinterServerMessenger(msgr) != B_OK)
24 return BString();
26 BMessage getNameOfActivePrinter(B_GET_PROPERTY);
27 getNameOfActivePrinter.AddSpecifier("ActivePrinter");
29 BMessage reply;
30 msgr.SendMessage(&getNameOfActivePrinter, &reply);
32 BString activePrinterName;
33 reply.FindString("result", &activePrinterName);
35 return activePrinterName;
39 status_t
40 GetPrinterServerMessenger(BMessenger& msgr)
42 // If print server is not yet running, start it
43 if (!be_roster->IsRunning(PSRV_SIGNATURE_TYPE))
44 be_roster->Launch(PSRV_SIGNATURE_TYPE);
46 msgr = BMessenger(PSRV_SIGNATURE_TYPE);
47 return msgr.IsValid() ? B_OK : B_ERROR;