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