зеркало из https://github.com/mozilla/gecko-dev.git
New animation support for containers which are loading. Also, if a load fails for a container, close it and report error to user.
This commit is contained in:
Родитель
5eb1e8ea9a
Коммит
e6a2ed680f
|
@ -193,11 +193,6 @@ rdf_GetUrlExitFunc (URL_Struct *urls, int status, MWContext *cx)
|
|||
|
||||
if ((status < 0) && (urls != NULL))
|
||||
{
|
||||
if ((cx != NULL) && (urls->error_msg != NULL))
|
||||
{
|
||||
FE_Alert(cx, urls->error_msg);
|
||||
}
|
||||
|
||||
/* if unable to read in navcntr.rdf file, create some default views */
|
||||
if ((f = (RDFFile) urls->fe_data) != NULL)
|
||||
{
|
||||
|
@ -213,7 +208,7 @@ rdf_GetUrlExitFunc (URL_Struct *urls, int status, MWContext *cx)
|
|||
{
|
||||
if ((f = (RDFFile) urls->fe_data) != NULL)
|
||||
{
|
||||
htLoadComplete(f->url, status);
|
||||
htLoadComplete(cx, urls, f->url, status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,29 +247,47 @@ rdfRetrievalType (RDFFile f)
|
|||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
ETEvent ce;
|
||||
char *url;
|
||||
URL_Struct *urls;
|
||||
int method;
|
||||
MWContext *cx;
|
||||
Net_GetUrlExitFunc *exitFunc;
|
||||
} MozillaEvent_rdf_GetURL;
|
||||
|
||||
|
||||
|
||||
PR_STATIC_CALLBACK(void *)
|
||||
rdf_HandleEvent_GetURL(MozillaEvent_rdf_GetURL *event)
|
||||
{
|
||||
if (event->url != NULL)
|
||||
{
|
||||
htLoadBegins(event->urls, event->url);
|
||||
}
|
||||
NET_GetURL(event->urls, event->method, event->cx, event->exitFunc);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
rdf_DisposeEvent_GetURL(MozillaEvent_rdf_GetURL *event)
|
||||
{
|
||||
if (event->url != NULL)
|
||||
{
|
||||
freeMem(event->url);
|
||||
event->url = NULL;
|
||||
}
|
||||
XP_FREE(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
rdf_GetURL (MWContext *cx, int method, Net_GetUrlExitFunc *exit_routine, RDFFile rdfFile)
|
||||
rdf_GetURL (MWContext *cx, int method, Net_GetUrlExitFunc *exit_routine, RDFFile rdfFile)
|
||||
{
|
||||
MozillaEvent_rdf_GetURL *event;
|
||||
URL_Struct *urls = NULL;
|
||||
|
@ -311,6 +324,7 @@ rdf_GetURL (MWContext *cx, int method, Net_GetUrlExitFunc *exit_routine, RDFFil
|
|||
|
||||
if (PR_CurrentThread() == mozilla_thread)
|
||||
{
|
||||
htLoadBegins(urls, url);
|
||||
NET_GetURL(urls, FO_CACHE_AND_RDF, cx, rdf_GetUrlExitFunc);
|
||||
}
|
||||
else
|
||||
|
@ -323,6 +337,7 @@ rdf_GetURL (MWContext *cx, int method, Net_GetUrlExitFunc *exit_routine, RDFFil
|
|||
PR_InitEvent(&(event->ce.event), cx,
|
||||
(PRHandleEventProc)rdf_HandleEvent_GetURL,
|
||||
(PRDestroyEventProc)rdf_DisposeEvent_GetURL);
|
||||
event->url = copyString(url);
|
||||
event->urls = urls;
|
||||
event->method = FO_CACHE_AND_RDF;
|
||||
event->cx = cx;
|
||||
|
|
|
@ -148,18 +148,83 @@ HT_Shutdown()
|
|||
|
||||
|
||||
|
||||
void
|
||||
htLoadComplete(char *url, int status)
|
||||
PRBool
|
||||
ht_UpdateURLstate(char *url, PRBool inProgressFlag, int status)
|
||||
{
|
||||
RDF_Resource pollR;
|
||||
HT_Pane paneList;
|
||||
HT_Resource node;
|
||||
RDF_Resource r;
|
||||
PRBool found = PR_FALSE;
|
||||
|
||||
if (url != NULL)
|
||||
{
|
||||
if ((pollR = RDF_GetResource(gNCDB, url, PR_TRUE)) != NULL)
|
||||
if ((r = RDF_GetResource(gNCDB, url, PR_TRUE)) != NULL)
|
||||
{
|
||||
if (pollR == pollingResource)
|
||||
paneList = gHTTop;
|
||||
while (paneList != NULL)
|
||||
{
|
||||
pollingResource = NULL;
|
||||
node = PR_HashTableLookup(paneList->hash, r);
|
||||
while (node != NULL)
|
||||
{
|
||||
found = PR_TRUE;
|
||||
if (inProgressFlag == PR_TRUE)
|
||||
{
|
||||
/* start node icon animation */
|
||||
node->flags |= HT_CONTENTS_LOADING_FLAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* stop node icon animation */
|
||||
node->flags &= (~HT_CONTENTS_LOADING_FLAG);
|
||||
}
|
||||
sendNotification(node, HT_EVENT_NODE_VPROP_CHANGED,
|
||||
gNavCenter->RDF_smallIcon, HT_COLUMN_STRING);
|
||||
|
||||
if ((inProgressFlag == PR_FALSE) && (status < 0))
|
||||
{
|
||||
/* problem, close container */
|
||||
HT_SetOpenState(node, PR_FALSE);
|
||||
}
|
||||
node = node->nextItem;
|
||||
}
|
||||
paneList = paneList->next;
|
||||
}
|
||||
|
||||
if (inProgressFlag == PR_FALSE)
|
||||
{
|
||||
if (r == pollingResource)
|
||||
{
|
||||
pollingResource = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(found);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
htLoadBegins(URL_Struct *urls, char *url)
|
||||
{
|
||||
ht_UpdateURLstate(url, PR_TRUE, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
htLoadComplete(MWContext *cx, URL_Struct *urls, char *url, int status)
|
||||
{
|
||||
PRBool found;
|
||||
|
||||
if (url != NULL)
|
||||
{
|
||||
found = ht_UpdateURLstate(url, PR_FALSE, status);
|
||||
if ((urls != NULL) && (found == PR_TRUE))
|
||||
{
|
||||
if ((cx != NULL) && (urls->error_msg != NULL))
|
||||
{
|
||||
FE_Alert(cx, urls->error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6077,7 +6142,11 @@ getIconURL( HT_Resource node, PRBool toolbarIconFlag, PRBool workspaceFlag, int
|
|||
break;
|
||||
}
|
||||
|
||||
if ((res == gNavCenter->RDF_smallIcon) || (res == gNavCenter->RDF_largeIcon))
|
||||
if ((res == gNavCenter->RDF_smallIcon) && (node->flags & HT_CONTENTS_LOADING_FLAG))
|
||||
{
|
||||
iconURL = "http://hackmeister.mcom.com/busy.gif";
|
||||
}
|
||||
else if ((res == gNavCenter->RDF_smallIcon) || (res == gNavCenter->RDF_largeIcon))
|
||||
{
|
||||
HT_GetNodeData(node, res, HT_COLUMN_STRING, &iconURL);
|
||||
if (iconURL == NULL)
|
||||
|
|
|
@ -171,16 +171,17 @@ typedef struct _HT_ValueStruct {
|
|||
void *data;
|
||||
} HT_ValueStruct, *HT_Value;
|
||||
|
||||
#define HT_CONTAINER_FLAG 0x0001
|
||||
#define HT_OPEN_FLAG 0x0002
|
||||
#define HT_AUTOFLUSH_OPEN_FLAG 0x0004
|
||||
#define HT_HIDDEN_FLAG 0x0008
|
||||
#define HT_SELECTED_FLAG 0x0010
|
||||
#define HT_VOLATILE_URL_FLAG 0x0020
|
||||
#define HT_PASSWORDOK_FLAG 0x0080
|
||||
#define HT_INITED_FLAG 0x0100
|
||||
#define HT_DIRTY_FLAG 0x0200
|
||||
#define HT_ENABLED_FLAG 0x0400
|
||||
#define HT_CONTAINER_FLAG 0x0001
|
||||
#define HT_OPEN_FLAG 0x0002
|
||||
#define HT_AUTOFLUSH_OPEN_FLAG 0x0004
|
||||
#define HT_HIDDEN_FLAG 0x0008
|
||||
#define HT_SELECTED_FLAG 0x0010
|
||||
#define HT_VOLATILE_URL_FLAG 0x0020
|
||||
#define HT_CONTENTS_LOADING_FLAG 0x0040
|
||||
#define HT_PASSWORDOK_FLAG 0x0080
|
||||
#define HT_INITED_FLAG 0x0100
|
||||
#define HT_DIRTY_FLAG 0x0200
|
||||
#define HT_ENABLED_FLAG 0x0400
|
||||
|
||||
typedef struct _HT_ResourceStruct {
|
||||
struct _HT_ResourceStruct *nextItem;
|
||||
|
@ -259,7 +260,9 @@ XP_BEGIN_PROTOS
|
|||
|
||||
void HT_Startup();
|
||||
void HT_Shutdown();
|
||||
void htLoadComplete(char *url, int status);
|
||||
PRBool ht_UpdateURLstate(char *url, PRBool inProgressFlag, int status);
|
||||
void htLoadBegins(URL_Struct *urls, char *url);
|
||||
void htLoadComplete(MWContext *cx, URL_Struct *urls, char *url, int status);
|
||||
void htTimerRoutine(void *timerID);
|
||||
PRBool possiblyUpdateView(HT_View view);
|
||||
void updateViewItem(HT_Resource node);
|
||||
|
|
Загрузка…
Ссылка в новой задаче