Change site styles structure for a more generic one
This commit is contained in:
parent
5c52733984
commit
d0e3c69e59
2 changed files with 6 additions and 6 deletions
|
@ -90,7 +90,7 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
|
||||||
* The iteration will stop at the first match, beginning at the beginning of
|
* The iteration will stop at the first match, beginning at the beginning of
|
||||||
* the list.
|
* the list.
|
||||||
*/
|
*/
|
||||||
static SiteStyle styles[] = {
|
static SiteSpecific styles[] = {
|
||||||
/* regexp file in $styledir */
|
/* regexp file in $styledir */
|
||||||
{ ".*", "default.css" },
|
{ ".*", "default.css" },
|
||||||
};
|
};
|
||||||
|
|
10
surf.c
10
surf.c
|
@ -136,9 +136,9 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *regex;
|
char *regex;
|
||||||
char *style;
|
char *file;
|
||||||
regex_t re;
|
regex_t re;
|
||||||
} SiteStyle;
|
} SiteSpecific;
|
||||||
|
|
||||||
/* Surf */
|
/* Surf */
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
@ -304,8 +304,8 @@ setup(void)
|
||||||
styles[i].regex);
|
styles[i].regex);
|
||||||
styles[i].regex = NULL;
|
styles[i].regex = NULL;
|
||||||
}
|
}
|
||||||
styles[i].style = g_strconcat(styledir, "/",
|
styles[i].file = g_strconcat(styledir, "/",
|
||||||
styles[i].style, NULL);
|
styles[i].file, NULL);
|
||||||
}
|
}
|
||||||
g_free(styledir);
|
g_free(styledir);
|
||||||
} else {
|
} else {
|
||||||
|
@ -748,7 +748,7 @@ getstyle(const char *uri)
|
||||||
for (i = 0; i < LENGTH(styles); ++i) {
|
for (i = 0; i < LENGTH(styles); ++i) {
|
||||||
if (styles[i].regex &&
|
if (styles[i].regex &&
|
||||||
!regexec(&(styles[i].re), uri, 0, NULL, 0))
|
!regexec(&(styles[i].re), uri, 0, NULL, 0))
|
||||||
return styles[i].style;
|
return styles[i].file;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Reference in a new issue