Fix links (variable now stay accessible)
This commit is contained in:
parent
05393d854b
commit
da73ac6ff0
|
@ -2,6 +2,7 @@
|
|||
#include "../include/gemgui.h"
|
||||
|
||||
void linkAction (GtkWidget *widget, gpointer data);
|
||||
extern char links[1024][20];
|
||||
|
||||
void
|
||||
addH1 (GtkWidget *root,
|
||||
|
|
|
@ -24,6 +24,7 @@ int parseFile (char *path);
|
|||
#else
|
||||
|
||||
extern GtkWidget *render;
|
||||
extern char links[1024][20];
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -32,6 +33,9 @@ parseFile (char *path)
|
|||
{
|
||||
FILE *fileToParse = fopen (path, "r");
|
||||
char line[4096];
|
||||
#ifndef TESTGEMPARSE
|
||||
int linkNumber = 0;
|
||||
#endif
|
||||
|
||||
if (fileToParse == NULL)
|
||||
{
|
||||
|
@ -125,12 +129,16 @@ parseFile (char *path)
|
|||
while (beginText < size && line[beginText] == ' ')
|
||||
beginText++;
|
||||
|
||||
#ifndef TESTGEMPARSE
|
||||
strcpy (links[linkNumber], line + beginUrl);
|
||||
#endif
|
||||
|
||||
//If not text, text = url
|
||||
if (beginText == size)
|
||||
#ifdef TESTGEMPARSE
|
||||
addLink (line + beginUrl, line + beginUrl);
|
||||
addLink (line + beginUrl, links[linkNumber]);
|
||||
#else
|
||||
addLink (render, line + beginUrl, line + beginUrl);
|
||||
addLink (render, links[linkNumber], links[linkNumber]);
|
||||
#endif
|
||||
else
|
||||
{
|
||||
|
@ -140,9 +148,13 @@ parseFile (char *path)
|
|||
#ifdef TESTGEMPARSE
|
||||
addLink (line + beginUrl, line + beginText);
|
||||
#else
|
||||
addLink (render, line + beginUrl, line + beginText);
|
||||
addLink (render, links[linkNumber], line + beginText);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef TESTGEMPARSE
|
||||
linkNumber++;
|
||||
#endif
|
||||
}
|
||||
else if (size > 3 && line[0] == '`' && line[1] == '`' && line[2] == '`')
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
GtkEntryBuffer *pathBarContent = NULL;
|
||||
GtkWidget *render = NULL;
|
||||
GtkWidget *scrollbar = NULL;
|
||||
char links[1024][20];
|
||||
|
||||
static void
|
||||
loadPage (const char *link)
|
||||
|
|
Loading…
Reference in New Issue