зеркало из https://github.com/mozilla/pjs.git
Icon handling rewritten.
This commit is contained in:
Родитель
b091b3b460
Коммит
561c46bd45
|
@ -2325,35 +2325,6 @@ deleteHTNode(HT_Resource node)
|
|||
}
|
||||
node->values = NULL;
|
||||
|
||||
if (node->flags & HT_FREEICON_URL_FLAG)
|
||||
{
|
||||
if (node->url[0] != NULL)
|
||||
{
|
||||
freeMem(node->url[0]);
|
||||
node->url[0] = NULL;
|
||||
}
|
||||
if (node->url[1] != NULL)
|
||||
{
|
||||
freeMem(node->url[1]);
|
||||
node->url[1] = NULL;
|
||||
}
|
||||
if (node->url[2] != NULL)
|
||||
{
|
||||
freeMem(node->url[2]);
|
||||
node->url[2] = NULL;
|
||||
}
|
||||
if (node->url[3] != NULL)
|
||||
{
|
||||
freeMem(node->url[3]);
|
||||
node->url[3] = NULL;
|
||||
}
|
||||
if (node->url[4] != NULL)
|
||||
{
|
||||
freeMem(node->url[4]);
|
||||
node->url[4] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!node->view->refreshingItemListp) && (node->view->itemList != NULL))
|
||||
{
|
||||
/* set node's associated entry in itemList to NULL */
|
||||
|
@ -2672,9 +2643,21 @@ void
|
|||
resynchItem (HT_Resource node, void *token, void *data, PRBool assertAction)
|
||||
{
|
||||
HT_Value *value, *nextValue, tempValue;
|
||||
RDF_Resource r = (RDF_Resource)token;
|
||||
|
||||
XP_ASSERT(node != NULL);
|
||||
|
||||
/* special check for handling icons... */
|
||||
|
||||
if (token == gNavCenter->RDF_smallIcon)
|
||||
{
|
||||
node->url[0] = NULL;
|
||||
}
|
||||
else if (token == gNavCenter->RDF_largeIcon)
|
||||
{
|
||||
node->url[1] = NULL;
|
||||
}
|
||||
|
||||
value = &(node->values);
|
||||
while ((*value) != NULL)
|
||||
{
|
||||
|
@ -2684,11 +2667,16 @@ resynchItem (HT_Resource node, void *token, void *data, PRBool assertAction)
|
|||
if ((*value)->tokenType == HT_COLUMN_STRING ||
|
||||
(*value)->tokenType == HT_COLUMN_DATE_STRING)
|
||||
{
|
||||
|
||||
if ((*value)->data)
|
||||
{
|
||||
freeMem((*value)->data);
|
||||
(*value)->data = NULL;
|
||||
}
|
||||
if ((data == NULL) || (((char *)data)[0] == '\0'))
|
||||
{
|
||||
assertAction = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((assertAction == false) || (data == NULL))
|
||||
|
@ -5657,38 +5645,14 @@ HT_SetNodeData (HT_Resource node, void *token, uint32 tokenType, void *data)
|
|||
RDF_Assert(node->view->pane->db, node->node,
|
||||
token, data, RDF_STRING_TYPE);
|
||||
}
|
||||
if (token == gNavCenter->RDF_smallIcon ||
|
||||
token == gNavCenter->RDF_largeIcon)
|
||||
if (token == gNavCenter->RDF_smallIcon)
|
||||
{
|
||||
if (node->flags & HT_FREEICON_URL_FLAG)
|
||||
{
|
||||
if (node->url[0] != NULL)
|
||||
{
|
||||
freeMem(node->url[0]);
|
||||
node->url[0] = NULL;
|
||||
}
|
||||
if (node->url[1] != NULL)
|
||||
else if (token == gNavCenter->RDF_largeIcon)
|
||||
{
|
||||
freeMem(node->url[1]);
|
||||
node->url[1] = NULL;
|
||||
}
|
||||
if (node->url[2] != NULL)
|
||||
{
|
||||
freeMem(node->url[2]);
|
||||
node->url[2] = NULL;
|
||||
}
|
||||
if (node->url[3] != NULL)
|
||||
{
|
||||
freeMem(node->url[3]);
|
||||
node->url[3] = NULL;
|
||||
}
|
||||
if (node->url[4] != NULL)
|
||||
{
|
||||
freeMem(node->url[4]);
|
||||
node->url[4] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
error = HT_NoErr;
|
||||
break;
|
||||
|
@ -6082,9 +6046,10 @@ char *
|
|||
getIconURL( HT_Resource node, PRBool toolbarIconFlag, PRBool workspaceFlag, int state)
|
||||
{
|
||||
|
||||
RDF_Resource res;
|
||||
RDF_Resource res = NULL;
|
||||
PRBool volatileURLFlag;
|
||||
int iconIndex;
|
||||
char *iconURL = NULL;
|
||||
|
||||
XP_ASSERT(node != NULL);
|
||||
XP_ASSERT(node->node != NULL);
|
||||
|
@ -6112,29 +6077,27 @@ getIconURL( HT_Resource node, PRBool toolbarIconFlag, PRBool workspaceFlag, int
|
|||
break;
|
||||
}
|
||||
|
||||
if ((res == gNavCenter->RDF_smallIcon) || (res == gNavCenter->RDF_largeIcon))
|
||||
{
|
||||
HT_GetNodeData(node, res, HT_COLUMN_STRING, &iconURL);
|
||||
if (iconURL == NULL)
|
||||
{
|
||||
if (res == gNavCenter->RDF_smallIcon) iconIndex = 0;
|
||||
else iconIndex = 1;
|
||||
|
||||
/* if volatile URL, flush if needed and re-create */
|
||||
|
||||
if (node->flags & HT_VOLATILE_URL_FLAG)
|
||||
{
|
||||
node->url[0] = NULL;
|
||||
node->url[1] = NULL;
|
||||
node->url[2] = NULL;
|
||||
node->url[3] = NULL;
|
||||
node->url[4] = NULL;
|
||||
}
|
||||
|
||||
if (node->url[iconIndex] == NULL)
|
||||
{
|
||||
if ((node->url[iconIndex] = (char*)RDF_GetSlotValue(node->view->pane->db,
|
||||
node->node, res, RDF_STRING_TYPE, false, true)) != NULL)
|
||||
{
|
||||
node->flags &= (~HT_VOLATILE_URL_FLAG);
|
||||
node->flags |= HT_FREEICON_URL_FLAG;
|
||||
}
|
||||
else
|
||||
if ((iconURL = node->url[iconIndex]) == NULL)
|
||||
{
|
||||
node->url[iconIndex] = buildInternalIconURL(node,
|
||||
&volatileURLFlag, false, workspaceFlag);
|
||||
iconURL = node->url[iconIndex];
|
||||
if (volatileURLFlag)
|
||||
{
|
||||
node->flags |= HT_VOLATILE_URL_FLAG;
|
||||
|
@ -6145,7 +6108,12 @@ getIconURL( HT_Resource node, PRBool toolbarIconFlag, PRBool workspaceFlag, int
|
|||
}
|
||||
}
|
||||
}
|
||||
return(node->url[iconIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
HT_GetNodeData(node, res, HT_COLUMN_STRING, &iconURL);
|
||||
}
|
||||
return(iconURL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -177,7 +177,6 @@ typedef struct _HT_ValueStruct {
|
|||
#define HT_HIDDEN_FLAG 0x0008
|
||||
#define HT_SELECTED_FLAG 0x0010
|
||||
#define HT_VOLATILE_URL_FLAG 0x0020
|
||||
#define HT_FREEICON_URL_FLAG 0x0040
|
||||
#define HT_PASSWORDOK_FLAG 0x0080
|
||||
#define HT_INITED_FLAG 0x0100
|
||||
#define HT_DIRTY_FLAG 0x0200
|
||||
|
@ -190,7 +189,7 @@ typedef struct _HT_ResourceStruct {
|
|||
RDF_Resource node;
|
||||
void *feData;
|
||||
char *dataSource;
|
||||
char *url[5];
|
||||
char *url[2];
|
||||
HT_Value values;
|
||||
HT_Resource child;
|
||||
HT_Resource *children; /* used by sorting */
|
||||
|
|
Загрузка…
Ссылка в новой задаче