* use the HVIF icon for the default printer folder, this will fix the black

rect arround the folder icon after setting the default printer on Haiku...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25618 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2008-05-22 20:38:14 +00:00
parent c749605ff1
commit fc0c84e771
2 changed files with 41 additions and 16 deletions
+22 -2
View File
@@ -76,8 +76,12 @@ main()
*/
PrintServerApp::PrintServerApp(status_t* err)
: Inherited(PSRV_SIGNATURE_TYPE, err),
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
fSelectedIcon(NULL),
#else
fSelectedIconMini(NULL),
fSelectedIconLarge(NULL),
#endif
fReferences(0),
fHasReferences(0),
fUseConfigWindow(true),
@@ -100,11 +104,16 @@ PrintServerApp::PrintServerApp(status_t* err)
RetrieveDefaultPrinter();
// Cache icons for selected printer
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
BMimeType type(PSRV_PRINTER_FILETYPE);
type.GetIcon(&fSelectedIcon, &fIconSize);
#else
fSelectedIconMini = new BBitmap(BRect(0,0,B_MINI_ICON-1,B_MINI_ICON-1), B_CMAP8);
fSelectedIconLarge = new BBitmap(BRect(0,0,B_LARGE_ICON-1,B_LARGE_ICON-1), B_CMAP8);
BMimeType type(PRNT_SIGNATURE_TYPE);
type.GetIcon(fSelectedIconMini, B_MINI_ICON);
type.GetIcon(fSelectedIconLarge, B_LARGE_ICON);
#endif
PostMessage(PSRV_PRINT_SPOOLED_JOB);
// Start handling of spooled files
@@ -147,8 +156,15 @@ PrintServerApp::QuitRequested()
fHasReferences = 0;
}
delete fSelectedIconMini; fSelectedIconMini = NULL;
delete fSelectedIconLarge; fSelectedIconLarge = NULL;
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
delete [] fSelectedIcon;
fSelectedIcon = NULL;
#else
delete fSelectedIconMini;
fSelectedIconMini = NULL;
delete fSelectedIconLarge;
fSelectedIconLarge = NULL;
#endif
return true;
}
@@ -507,8 +523,12 @@ PrintServerApp::SelectPrinter(const char* printerName)
if (rc == B_OK) {
// and add the custom icon
BNodeInfo info(&node);
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
info.SetIcon(fSelectedIcon, fIconSize);
#else
info.SetIcon(fSelectedIconMini, B_MINI_ICON);
info.SetIcon(fSelectedIconLarge, B_LARGE_ICON);
#endif
}
fDefaultPrinter = Printer::Find(printerName);
+19 -14
View File
@@ -31,15 +31,15 @@ class PrintServerApp : public BApplication, public FolderListener {
public:
PrintServerApp(status_t *err);
~PrintServerApp();
~PrintServerApp();
void Acquire();
void Release();
bool QuitRequested();
void MessageReceived(BMessage *msg);
void NotifyPrinterDeletion(Printer *printer);
// Scripting support, see PrintServerApp.Scripting.cpp
status_t GetSupportedSuites(BMessage *msg);
void HandleScriptingCommand(BMessage *msg);
@@ -51,30 +51,30 @@ class PrintServerApp : public BApplication, public FolderListener {
bool OpenSettings(BFile &file, const char *name, bool forReading);
void LoadSettings();
void SaveSettings();
status_t SetupPrinterList();
void HandleSpooledJobs();
status_t SelectPrinter(const char *printerName);
status_t CreatePrinter(const char *printerName, const char *driverName,
const char *connection, const char *transportName,
const char *transportPath);
void RegisterPrinter(BDirectory *node);
void UnregisterPrinter(Printer *printer);
// FolderListener
void EntryCreated(node_ref *node, entry_ref *entry);
void EntryRemoved(node_ref *node);
void AttributeChanged(node_ref *node);
status_t StoreDefaultPrinter();
status_t RetrieveDefaultPrinter();
status_t FindPrinterNode(const char *name, BNode &node);
status_t FindPrinterDriver(const char *name, BPath &outPath);
// "Classic" BeOS R5 support, see PrintServerApp.R5.cpp
static status_t async_thread(void *data);
void AsyncHandleMessage(BMessage *msg);
@@ -82,14 +82,19 @@ class PrintServerApp : public BApplication, public FolderListener {
ResourceManager fResourceManager;
Printer *fDefaultPrinter;
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
size_t fIconSize;
uint8 *fSelectedIcon;
#else
BBitmap *fSelectedIconMini;
BBitmap *fSelectedIconLarge;
vint32 fReferences;
#endif
vint32 fReferences;
sem_id fHasReferences;
Settings *fSettings;
bool fUseConfigWindow;
FolderWatcher *fFolder;
};
#endif