[haiku-commits] haiku: hrev49804 - in src/kits: tracker storage

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 10 Nov 2015 18:21:56 +0100 (CET)

hrev49804 adds 1 changeset to branch 'master'
old head: 70708ef97dde39c1b34ee2a8931ef7ac0b08e435
new head: d3628dcd8f5526fd87162f0c106f3875c83fcbe7
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=d3628dcd8f55+%5E70708ef97dde

----------------------------------------------------------------------------

d3628dcd8f55: IK: Move CheckNodeIconHintPrivate to Tracker

* Move BPrivate::BNodeInfo::CheckNodeIconHintPrivate() to Tracker's
Model class.
* Rename HasVectorIconHint(BNode*) to CheckNodeIconHint(BNode*).
and make it check not only for vector icons but also if you have
BOTH large and mini icons.
* Replace instances of CheckNodeIconHintPrivate() with the newly
created CheckNodeIconHint().

[ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision: hrev49804
Commit: d3628dcd8f5526fd87162f0c106f3875c83fcbe7
URL: http://cgit.haiku-os.org/haiku/commit/?id=d3628dcd8f55
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Tue Nov 10 17:15:17 2015 UTC

----------------------------------------------------------------------------

2 files changed, 19 insertions(+), 54 deletions(-)
src/kits/storage/NodeInfo.cpp | 22 -----------------
src/kits/tracker/Model.cpp | 51 +++++++++++++++------------------------

----------------------------------------------------------------------------

diff --git a/src/kits/storage/NodeInfo.cpp b/src/kits/storage/NodeInfo.cpp
index f1d9624..97837b2 100644
--- a/src/kits/storage/NodeInfo.cpp
+++ b/src/kits/storage/NodeInfo.cpp
@@ -624,25 +624,3 @@ BNodeInfo::operator=(const BNodeInfo &nodeInfo)
BNodeInfo::BNodeInfo(const BNodeInfo &)
{
}
-
-
-namespace BPrivate {
-
-/*! Private method used by Tracker.
-
- This should be moved to the Tracker source.
-*/
-extern bool
-CheckNodeIconHintPrivate(const BNode* node, bool checkMiniIconOnly)
-{
- attr_info info;
- if (node->GetAttrInfo(kNIMiniIconAttribute, &info) != B_OK &&
checkMiniIconOnly)
- return false;
-
- if (node->GetAttrInfo(kNILargeIconAttribute, &info) != B_OK)
- return false;
-
- return true;
-}
-
-} // namespace BPrivate
diff --git a/src/kits/tracker/Model.cpp b/src/kits/tracker/Model.cpp
index ab16265..c1db78a 100644
--- a/src/kits/tracker/Model.cpp
+++ b/src/kits/tracker/Model.cpp
@@ -82,22 +82,22 @@ BObjectList<Model>* readOnlyOpenModelList = NULL;
#endif


-namespace BPrivate {
-extern
-#ifdef _IMPEXP_BE
-_IMPEXP_BE
-#endif
-bool CheckNodeIconHintPrivate(const BNode*, bool);
-} // namespace BPrivate
-
-
-
-
static bool
-HasVectorIconHint(BNode* node)
+CheckNodeIconHint(BNode* node)
{
+ if (node == NULL)
+ return false;
+
attr_info info;
- return node->GetAttrInfo(kAttrIcon, &info) == B_OK;
+ if (node->GetAttrInfo(kAttrIcon, &info) == B_OK
+ // has a vector icon, or
+ || (node->GetAttrInfo(kAttrMiniIcon, &info) == B_OK
+ && node->GetAttrInfo(kAttrLargeIcon, &info) == B_OK)) {
+ // has a mini _and_ large icon
+ return true;
+ }
+
+ return false;
}


@@ -614,24 +614,12 @@ Model::FinishSettingUpType()
char mimeString[B_MIME_TYPE_LENGTH];
BEntry entry;

- // while we are reading the node, do a little
- // snooping to see if it even makes sense to look for a node-based
- // icon
- // This serves as a hint to the icon cache, allowing it to not hit the
- // disk again for models that do not have an icon defined by the node
- if (IsNodeOpen()
- && fBaseType != kLinkNode
- && !CheckNodeIconHintPrivate(fNode,
- dynamic_cast<TTracker*>(be_app) == NULL)
- && !HasVectorIconHint(fNode)) {
- // when checking for the node icon hint, if we are
libtracker,
- // only check for small icons - checking for the large
icons
- // is a little more work for the filesystem and this
will
- // speed up the test. This makes node icons only work
if there
- // is a small and a large node icon on a file - for
libtracker
- // that is not a problem though
+ // While we are reading the node, do a little snooping to see if it even
+ // makes sense to look for a node-based icon. This serves as a hint to
the
+ // icon cache, allowing it to not hit the disk again for models that do
not
+ // have an icon defined by the node.
+ if (IsNodeOpen() && fBaseType != kLinkNode && !CheckNodeIconHint(fNode))
fIconFrom = kUnknownNotFromNode;
- }

if (fBaseType != kDirectoryNode
&& fBaseType != kVolumeNode
@@ -761,8 +749,7 @@ Model::ResetIconFrom()
// mirror the logic from FinishSettingUpType
if ((fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
- && !CheckNodeIconHintPrivate(fNode,
- dynamic_cast<TTracker*>(be_app) == NULL)) {
+ && !CheckNodeIconHint(fNode)) {
BDirectory* directory = dynamic_cast<BDirectory*>(fNode);
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
fIconFrom = kTrackerSupplied;


Other related posts:

  • » [haiku-commits] haiku: hrev49804 - in src/kits: tracker storage - jscipione